$OpenBSD: patch-gnats_lists_c,v 1.1 2003/08/25 23:35:06 brad Exp $
--- gnats/lists.c.orig	Wed Nov 25 07:15:01 1998
+++ gnats/lists.c	Wed Jul  2 13:23:13 2003
@@ -33,11 +33,13 @@ get_gnats_file (type, file)
   char line[STR_MAX];
   char *path = (char *) alloca (PATH_MAX);
   extern int doret;
+  size_t len;
 
   if (file)
     {
-      outf = (char *) xmalloc (strlen (file) + 5);
-      strcpy (outf, file);
+      len = strlen (file) + 5;
+      outf = (char *) xmalloc (len);
+      strlcpy (outf, file, len);
     }
   else
     fpout = stdout;
@@ -45,37 +47,37 @@ get_gnats_file (type, file)
   if (type == LIST_CATEGORIES)
     {
       if (outf)
-	strcat (outf, ".cat");
+	strlcat (outf, ".cat", len);
       infile = CATEGORIES;
     }
   else if (type == LIST_SUBMITTERS)
     {
       if (outf)
-	strcat (outf, ".sub");
+	strlcat (outf, ".sub", len);
       infile = SUBMITTERS;
     }
   else if (type == LIST_RESPONSIBLE)
     {
       if (outf)
-	strcat (outf, ".res");
+	strlcat (outf, ".res", len);
       infile = RESPONSIBLE_FILE;
     }
   else if (type == LIST_STATES)
     {
       if (outf)
-	strcat (outf, ".sta");
+	strlcat (outf, ".sta", len);
       infile = STATES;
     }
   else if (type == LIST_CLASSES)
     {
       if (outf)
-	strcat (outf, ".cla");
+	strlcat (outf, ".cla", len);
       infile = CLASSES;
     }
   else if (type == LIST_CONFIG)
     {
       if (outf)
-	strcat (outf, ".cfg");
+	strlcat (outf, ".cfg", len);
       infile = CONFIG;
     }
   else
@@ -126,7 +128,7 @@ get_gnats_file (type, file)
     }
   else
     {
-      sprintf (path, "%s/gnats-adm/%s", gnats_root, infile);
+      snprintf (path, PATH_MAX, "%s/gnats-adm/%s", gnats_root, infile);
       fpin = fopen (path, "r");
       if (fpin == (FILE *)NULL)
           return -1; /* XXX */
